<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //请实现以下效果
        function add (a, b, c) {
            return a + b + c
        }
        const res = add(1, 2, 3) // 6
  function Curry(func){
            return function addCurry (...args){//表示传入的实参
              if(args.length<func.length){//实参是否小于形参
                  return function(){
                    // Array.from（）方法是将一个伪数组转化为真数组  
                      return addCurry(...args.concat(Array.from(arguments)));
                  }
              }
              return func(...args)
              }
            }
        const keLiHua=Curry(add)
        // console.log(addCurry);
        const res2 = keLiHua(1)(2)(3) // 6
        console.log(res2);
    </script>
</body>

</html>